package com.sinopec.yelofixedreader.uhf.presenter

import com.sinopec.basemodule.base.BaseView
import com.sinopec.basemodule.constants.PreferencesConstant
import com.sinopec.yelofixedreader.uhf.api.RFIDApi
import com.sinopec.yelofixedreader.uhf.contract.RFIDContract

/**
 * lwj at 2023/6/6
 * rfid 编码规则p
 */
class RFIDPresenter(view: BaseView) : RFIDContract.P(view) {
    override fun requestAndSaveRfidRule() {
        RFIDApi.rfidRule().requestWithScope {
            onSuccess {
                val regex = it.productCodeRegex
                if (regex!=null){
                    PreferencesConstant.getInstance().rfid_regex = regex
                }
            }
            onError {
                mView?.showMessage(it?.message)
            }
        }
    }
}